<template>
  <div class="school">
      <h2>学校名称：{{name}}</h2>
      <h2>学校地址：{{address}}</h2>

  </div>
</template>

<script>


export default {

  // eslint-disable-next-line vue/multi-word-component-names
  name: "Student",
  data(){
    return{
      address:'重庆市巴南区红光大道',
      name:'重庆理工大学',

    }
  },
  mounted() {
    //给傀儡绑定一个hello事件
    this.$bus.$on('hello',(data)=>{
      console.log('我是School组件收到了数据',data)
    })
  },
  //若用完最好销毁事件 $off
  beforeDestroy() {
    this.$bus.$off('hello')
  }

}
</script>

<style scoped>
    .student{
      background-color: skyblue;
      padding: 10px;
    }
</style>
